﻿namespace Game
{
    class Player : Sprite
    {
        private int numImage;
        private bool movingRight;
        private bool movingDown;


        public Player()
        {
            LoadImage("data/lemming1.png");
            MoveTo(250, 143);
            xSpeed = 4;
            ySpeed = 4;
            numImage = 0;
            movingRight = true;
            movingDown = true;
        }

        public void changeImage()
        {
            if (numImage == 0 && movingRight)
            {
                LoadImage("data/lemmingRight0.png");
                numImage++;
            }
            else if (numImage == 1 && movingRight)
            {
                LoadImage("data/lemmingRight1.png");
                numImage = 0;
            }

            else if (numImage == 0 && !movingRight)
            {
                LoadImage("data/lemmingLeft0.png");
                numImage++;
            }
            else if (numImage == 1 && !movingRight)
            {
                LoadImage("data/lemmingLeft1.png");
                numImage = 0;
            }
        }

        /*public void changeImagePrickle()
        {
            if (numImage == 0 && movingRight)
            {
                LoadImage("data/lemmingPrickle1.png");
                numImage++;
            }
            else if(numImage == 1 && movingRight)
            {
                LoadImage("data/lemmingPrickle2.png");
                numImage = 0;
            }

            else if (numImage == 0 && !movingRight)
            {
                LoadImage("data/lemmingPrickle1.png");
                numImage++;
            }
            else if (numImage == 1 && !movingRight)
            {
                LoadImage("data/lemmingPrickle2.png");
                numImage = 0;
            }
        }*/

        public void MoveRight()
        {
            x += xSpeed;
            changeImage();
        }

        public void MoveUp()
        {
            y -= ySpeed;
            changeImage();
        }

        public void MoveDown()
        {
            y += ySpeed;
            changeImage();
        }

        public void MoveLeft()
        {
            x -= xSpeed;
            changeImage();
        }

        public void Dig()
        {

        }

        public void Prickle()
        {
            
        }

        public int GetPositionX()
        {
            return x;
        }
        public int GetPositionY()
        {
            return y;
        }

        public bool GetMovingRight()
        {
            return movingRight;
        }

        public void SetMovingRight(bool move)
        {
            movingRight  = move;
        }

        public bool GetMovingDown()
        {
            return movingDown;
        }

        public void SetMovingDown(bool move)
        {
            movingDown = move;
        }

        public void DoAbility(int ability)
        {
            if (ability == 1)
            {
                y += 10;
            }
        }
    }

}
